﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WorkStation.Frameworks.EasyBus.DbModel
{
    /// <summary>
    /// 消息日志信息
    /// </summary>
    public class MessageLog
    {
        public string _id { get; set; }

        /// <summary>
        /// 消息路由关键字
        /// </summary>
        public string RouteKey { get; set; }

        /// <summary>
        /// 消息编号
        /// </summary>
        public string MessageId { get; set; }

        /// <summary>
        /// 消息对象（使用Json序列化存储）
        /// </summary>
        public string Json { get; set; }

        /// <summary>
        /// 发布消息宿主IP
        /// </summary>
        public string PublishServerIp { get; set; }

        /// <summary>
        /// 发布端总线名称
        /// </summary>
        public string PublishBusName { get; set; }

        /// <summary>
        /// 发布端总线节点名称
        /// </summary>
        public string PublishBusNodeName { get; set; }

        /// <summary>
        /// 建立时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        public bool IsSuccessPublish { get; set; }
        public bool IsSuccessProcess { get; set; }

        /// <summary>
        /// 消息发布日志
        /// </summary>
        public List<MessagePublishLog> PublishLogs { get; set; }

        /// <summary>
        /// 消息处理日志
        /// </summary>
        public List<MessageProcessLog> ProcessLogs { get; set; }

        public MessageLog() 
        {
            this._id = Guid.NewGuid().ToString();

            this.PublishLogs = new List<MessagePublishLog>();
            this.ProcessLogs = new List<MessageProcessLog>();
        }
    }
}
